package com.ymatou.iapi.trading.operate.testcase;

import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.common.lang.CipherUtil;
import com.ymatou.iapi.synctrade.parameter.mongo.Order;
import com.ymatou.iapi.synctrade.service.TradingSyncService;
import com.ymatou.iapi.trading.operate.parameter.req.ChangeOrderAddressBean;
import com.ymatou.iapi.trading.operate.service.ChangeOrderAddressCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.common.enums.UserTypeEnum;
import com.ymttest.database.sqlwapper.DefaultWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;

/**
 * 修改收货人地址 FreeMaker Template自动生成代码
 */
@TestSuite
@SuppressWarnings({"unchecked", "rawtypes"})
public class Ts_ChangeOrderAddress {

	private static ChangeOrderAddressBean coabean;
	private static ChangeOrderAddressCall coacall;
	String phoneKey = "123456789";
	String addressKey = "123456789";

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("修改收货人地址");
	}

	@Before
	public void caseUp() {

		coabean = new ChangeOrderAddressBean();
		coacall = new ChangeOrderAddressCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(coacall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	public void verifyYmtOrders(long orderId) throws Exception {

		Logger.comment("验证YmtOrders数据库");

		DefaultWapper database = new DefaultWapper();
		Map<String, Object> map = database.selectOrderByOderId(orderId).get(0);

		Logger.verifyEquals(coabean.getReceievePerson(),
				map.get("sReceivePerson"), "验证修改后的收货人");

		Logger.verifyEquals(coabean.getAddress(), map.get("sAddress"),
				"验证修改后的收货地址");
		Logger.verifyEquals(
				CipherUtil.encryptAES(addressKey, coabean.getAddress()),
				map.get("UserAddress"), "验证修改后的加密收货地址");
		Logger.verifyEquals(coabean.getAddress(), CipherUtil.decryptAES(
				addressKey, map.get("UserAddress").toString()), "验证修改后的解密收货地址");

		Logger.verifyEquals(coabean.getPostCode(), map.get("sPostCode"),
				"验证修改后的邮编");

		Logger.verifyEquals(coabean.getPhone(), map.get("sPhone"), "验证修改后的手机");
		Logger.verifyEquals(
				CipherUtil.encryptAES(this.phoneKey, coabean.getPhone()),
				map.get("UserPhone"), "验证修改后的加密手机");
		Logger.verifyEquals(coabean.getPhone(), CipherUtil.decryptAES(
				this.phoneKey, map.get("UserPhone").toString()), "验证修改后的解密手机");

		Logger.verifyEquals(coabean.getTelephone(), database
				.selectOrderByOderId(orderId).get(0).get("sTelephone"),
				"验证修改后的固定电话");
		Logger.verifyEquals(
				CipherUtil.encryptAES(this.phoneKey, coabean.getTelephone()),
				map.get("UserTelePhone"), "验证修改后的加密固定号码");
		Logger.verifyEquals(coabean.getTelephone(), CipherUtil.decryptAES(
				this.phoneKey, map.get("UserTelePhone").toString()),
				"验证修改后的解密固定号码");
	}

	public void verifyYmtOrderAddressHistory(long orderId,
			Map<String, Object> ordersMap) throws Exception {

		Logger.comment("验证YmtOrderAddressHistory数据库");

		DefaultWapper database = new DefaultWapper();
		Map<String, Object> map = database
				.selectOrderAddressHistoryByOrderId(orderId);

		Logger.verifyEquals(ordersMap.get("sReceivePerson"),
				map.get("ReceivePerson"), "验证修改后的收货人");

		Logger.verifyEquals(ordersMap.get("sAddress"), map.get("Address"),
				"验证修改后的收货地址");
		Logger.verifyEquals(CipherUtil.encryptAES(addressKey,
				ordersMap.get("sAddress").toString()), map.get("UserAddress"),
				"验证修改后的加密收货地址");
		Logger.verifyEquals(ordersMap.get("sAddress").toString(), CipherUtil
				.decryptAES(addressKey, map.get("UserAddress").toString()),
				"验证修改后的解密收货地址");

		Logger.verifyEquals(ordersMap.get("sPostCode"), map.get("PostCode"),
				"验证修改后的邮编");

		Logger.verifyEquals(ordersMap.get("sPhone"), map.get("Phone"),
				"验证修改后的手机");
		Logger.verifyEquals(CipherUtil.encryptAES(this.phoneKey,
				ordersMap.get("sPhone").toString()), map.get("UserPhone"),
				"验证修改后的加密手机");
		Logger.verifyEquals(ordersMap.get("sPhone"), CipherUtil.decryptAES(
				this.phoneKey, map.get("UserPhone").toString()), "验证修改后的解密手机");

		if (ordersMap.get("sTelephone").toString().equalsIgnoreCase("")) {

			Logger.verifyEquals(ordersMap.get("sTelephone"),
					map.get("Telephone"), "验证修改后的固定电话");
			Logger.verifyEquals(
					CipherUtil.encryptAES(this.phoneKey,
							ordersMap.get("sTelephone").toString()),
					map.get("UserTelePhone"), "验证修改后的加密固定号码");
			Logger.verifyEquals(
					ordersMap.get("sTelephone"),
					CipherUtil.decryptAES(this.phoneKey,
							map.get("UserTelePhone").toString()),
					"验证修改后的解密固定号码");

		}
	}

	public void verifyMongoOrder(long orderId) throws Exception {

		Logger.comment("验证mongo的Order数据库");

		Order orderMongo = TradingSyncService.getOrderFromMongo(orderId);

		Logger.verifyEquals(coabean.getPhone(),
				CipherUtil.decryptAES(this.phoneKey, orderMongo.getUphone()),
				"验证同步数据库修改后的解密手机号码");

		Logger.verifyEquals(coabean.getAddress(), CipherUtil.decryptAES(
				this.addressKey, orderMongo.getUaddress()), "验证同步数据库修改后的解密地址");
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_001() {
		Logger.start(true, "订单状态为待付款,买家修改收货人地址成功");
		try {
			// 老下单已经不可用，从数据库load出来一条数据进行修改，订单号要小于1000000000
			Logger.comment("前置数据准备");

			DefaultWapper database = new DefaultWapper();
			long orderId = 112767231;
			Map<String, Object> map = database.selectOrderByOderId(orderId)
					.get(0);

			Logger.comment("前置数据准备結束");

			// 设置参数
			String address = TestDataManager.randomStr(5)
					+ TestDataManager.getChineseName();
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			coabean.setOrderId((int) map.get("iOrderId"));
			String phone = 139 + TestDataManager.getRandomNum(8);
			coabean.setPhone(phone);
			String postCode = TestDataManager.getRandomNum(6);
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = TestDataManager.getChineseName();
			coabean.setReceievePerson(receievePerson);
			String telephone = 021 + TestDataManager.getRandomNum(8);
			coabean.setTelephone(telephone);
			coabean.setUserId((int) map.get("iUserId"));
			coabean.setUserType(UserTypeEnum.Normal);

			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.SUCCESS, coacall.getCode(), "验证Code");

			// 验证数据库
			this.verifyYmtOrders(orderId);
			this.verifyYmtOrderAddressHistory(orderId, map);
			this.verifyMongoOrder(orderId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_002() {
		Logger.start(true, "订单状态为已付款，买家修改收货人地址成功");
		try {
			// 老下单已经不可用，从数据库load出来一条数据进行修改，订单号要小于1000000000
			Logger.comment("前置数据准备");

			DefaultWapper database = new DefaultWapper();
			long orderId = 112767514;
			Map<String, Object> map = database.selectOrderByOderId(orderId)
					.get(0);

			Logger.comment("前置数据准备結束");

			String address = TestDataManager.randomStr(5)
					+ TestDataManager.getChineseName();
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			coabean.setOrderId((int) map.get("iOrderId"));
			String phone = 139 + TestDataManager.getRandomNum(8);
			coabean.setPhone(phone);
			String postCode = TestDataManager.getRandomNum(6);
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = TestDataManager.getChineseName();
			coabean.setReceievePerson(receievePerson);
			String telephone = 021 + TestDataManager.getRandomNum(8);
			coabean.setTelephone(telephone);
			coabean.setUserId((int) map.get("iUserId"));
			coabean.setUserType(UserTypeEnum.Normal);

			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.SUCCESS, coacall.getCode(), "验证Code");

			// 验证数据库
			this.verifyYmtOrders(orderId);
			this.verifyYmtOrderAddressHistory(orderId, map);
			this.verifyMongoOrder(orderId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_003() {
		Logger.start(true, "订单状态为已接单，买家修改收货人地址失败");
		try {
			// 老下单已经不可用，从数据库load出来一条数据进行修改，订单号要小于1000000000
			Logger.comment("前置数据准备");

			DefaultWapper database = new DefaultWapper();
			long orderId = 112767498;
			Map<String, Object> map = database.selectOrderByOderId(orderId)
					.get(0);

			Logger.comment("前置数据准备結束");

			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			coabean.setOrderId((int) orderId);
			String phone = "13200000005";
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "洋码头";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId((int) map.get("iUserId"));
			coabean.setUserType(UserTypeEnum.Normal);
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.FAILED201, coacall.getCode(), "验证Code");
			Logger.verifyEquals(ECode.FAILED201_MSG_14, coacall.getMsg(),
					"验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_004() {
		Logger.start(true, "订单状态为待付款,卖家修改收货人地址失败");
		try {
			// 老下单已经不可用，从数据库load出来一条数据进行修改，订单号要小于1000000000
			Logger.comment("前置数据准备");

			DefaultWapper database = new DefaultWapper();
			long orderId = 112767231;
			Map<String, Object> map = database.selectOrderByOderId(orderId)
					.get(0);

			Logger.comment("前置数据准备結束");

			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			coabean.setOrderId((int) orderId);
			String phone = "13200000005";
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "洋码头";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId((int) map.get("iBuyerId"));
			coabean.setUserType(UserTypeEnum.Seller);
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.FAILED201, coacall.getCode(), "验证Code");
			Logger.verifyEquals(ECode.FAILED201_MSG_14, coacall.getMsg(),
					"验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_005() {
		Logger.start(true, "订单状态为已接单，卖家修改收货人地址成功");
		try {
			// 老下单已经不可用，从数据库load出来一条数据进行修改，订单号要小于1000000000
			Logger.comment("前置数据准备");

			DefaultWapper database = new DefaultWapper();
			long orderId = 112767498;
			Map<String, Object> map = database.selectOrderByOderId(orderId)
					.get(0);

			Logger.comment("前置数据准备結束");

			// 设置参数
			String address = TestDataManager.randomStr(5)
					+ TestDataManager.getChineseName();
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			coabean.setOrderId((int) map.get("iOrderId"));
			String phone = 139 + TestDataManager.getRandomNum(8);
			coabean.setPhone(phone);
			String postCode = TestDataManager.getRandomNum(6);
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = TestDataManager.getChineseName();
			coabean.setReceievePerson(receievePerson);
			String telephone = 021 + TestDataManager.getRandomNum(8);
			coabean.setTelephone(telephone);
			coabean.setUserId((int) map.get("iBuyerId"));
			coabean.setUserType(UserTypeEnum.Seller);

			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.SUCCESS, coacall.getCode(), "验证Code");

			// 验证数据库
			this.verifyYmtOrders(orderId);
			this.verifyYmtOrderAddressHistory(orderId, map);
			this.verifyMongoOrder(orderId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_007() {
		Logger.start(true, "订单不存在，修改订单地址失败");
		try {
			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			int orderId = 132314214;
			coabean.setOrderId(orderId);
			String phone = "13200000005";
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "洋码头";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId(288484);
			coabean.setUserType(UserTypeEnum.Seller);
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.FAILED201, coacall.getCode(), "验证Code");
			Logger.verifyIsContains(ECode.FAILED201_MSG_11, coacall.getMsg(),
					"验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ChangeOrderAddress_008() {
		Logger.start(false, "订单号为null,修改订单地址失败");
		try {
			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			// coabean.setOrderId(orderId);
			String phone = "13200000005";
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "洋码头";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId(288484);
			coabean.setUserType(UserTypeEnum.Seller);
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.ERROR400, coacall.getCode(), "验证Code");
			Logger.verifyEquals("orderId:订单号不能为空", coacall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ChangeOrderAddress_009() {
		Logger.start(false, "操作用户id为null,修改订单地址失败");
		try {
			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			int orderId = 132314214;
			coabean.setOrderId(orderId);
			String phone = "13200000005";
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "洋码头";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			// coabean.setUserId(288484);
			coabean.setUserType(UserTypeEnum.Seller);
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.ERROR400, coacall.getCode(), "验证Code");
			Logger.verifyEquals("userId:操作用户Id未提供", coacall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ChangeOrderAddress_010() {
		Logger.start(false, "收货人地址为null,修改订单地址失败");
		try {
			// 设置参数
			// coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			int orderId = 132314214;
			coabean.setOrderId(orderId);
			String phone = "13200000005";
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "洋码头";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId(288484);
			coabean.setUserType(UserTypeEnum.Seller);
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.ERROR400, coacall.getCode(), "验证Code");
			Logger.verifyIsContains(ECode.ERROR400_MSG_36, coacall.getMsg(),
					"验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_ChangeOrderAddress_011() {
		Logger.start(false, "收货人null,修改订单地址失败");
		try {
			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			int orderId = 132314214;
			coabean.setOrderId(orderId);
			String phone = "13200000005";
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			// coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId(288484);
			coabean.setUserType(UserTypeEnum.Seller);
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.ERROR400, coacall.getCode(), "验证Code");
			Logger.verifyEquals("receivePerson:收货人姓名不能为空", coacall.getMsg(),
					"验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_012() {
		Logger.start(true, "订单状态为已付款,新的收货人没有上传身份证,卖家修改收货人地址成功");
		try {
			// 老下单已经不可用，从数据库load出来一条数据进行修改，订单号要小于1000000000
			Logger.comment("前置数据准备");

			DefaultWapper database = new DefaultWapper();
			long orderId = 112767503;
			Map<String, Object> map = database.selectOrderByOderId(orderId)
					.get(0);

			Logger.comment("前置数据准备結束");
			
			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			coabean.setOrderId((int) orderId);
			String phone = 139 + TestDataManager.getRandomNum(8);
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "洋码头";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId((int) map.get("iBuyerId"));
			coabean.setUserType(UserTypeEnum.Seller);
			
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.SUCCESS, coacall.getCode(), "验证Code");
			
			// 验证数据库
			this.verifyYmtOrders(orderId);
			this.verifyYmtOrderAddressHistory(orderId, map);
			this.verifyMongoOrder(orderId);

			// 订单扩展表
			List<Map> ymtOrdersExt = database.selectOrderExtByOderId(orderId);

			Logger.verifyEquals(null,
					ymtOrdersExt.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ChangeOrderAddress_013() {
		Logger.start(true, "订单状态为已付款,新的收货人已经上传身份证,卖家修改收货人地址成功");
		try {
			// 老下单已经不可用，从数据库load出来一条数据进行修改，订单号要小于1000000000
			Logger.comment("前置数据准备");

			DefaultWapper database = new DefaultWapper();
			long orderId = 112767503;
			Map<String, Object> map = database.selectOrderByOderId(orderId)
					.get(0);

			Logger.comment("前置数据准备結束");
			
			// 设置参数
			String address = "南京路步行街";
			coabean.setAddress(address);
			String changeTime = YMTDateUtil.getSysTime();
			coabean.setChangeTime(changeTime);
			String email = TestDataManager.getEmail();
			coabean.setEmail(email);
			coabean.setOrderId((int) orderId);
			String phone = 139 + TestDataManager.getRandomNum(8);
			coabean.setPhone(phone);
			String postCode = "986574";
			coabean.setPostCode(postCode);
			coabean.setQQ("100001");
			String receievePerson = "李四";
			coabean.setReceievePerson(receievePerson);
			String telephone = "021-51025140";
			coabean.setTelephone(telephone);
			coabean.setUserId((int) map.get("iBuyerId"));
			coabean.setUserType(UserTypeEnum.Seller);
			
			// 发送请求
			coacall.setData(coabean);
			coacall.callService();
			Logger.verifyEquals(ECode.SUCCESS, coacall.getCode(), "验证Code");
			
			// 验证数据库
			this.verifyYmtOrders(orderId);
			this.verifyYmtOrderAddressHistory(orderId, map);
			this.verifyMongoOrder(orderId);

			Thread.sleep(3000);

			// 订单扩展表
			List<Map> ymtOrdersExt = database.selectOrderExtByOderId(orderId);

			Logger.verifyEquals(null,
					ymtOrdersExt.get(0).get("bHaveUploadedIdCard"), "验证身份证状态");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	public static void main(String[] args) throws Exception {

		System.out
				.println(CipherUtil.encryptAES("12345678", "灵石路695号3号楼1404室"));
		System.out
				.println(CipherUtil
						.decryptAES("8765432187654321",
								"8ABC093B224CB9442965"));
	}
}